package com.wdf.statemachine.controller;

import cn.hutool.core.lang.Console;
import com.wdf.statemachine.entity.Order;
import com.wdf.statemachine.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author wengdianfeng
 * @Date 2024/7/8 下午2w06
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    private List<Order> orderList = new ArrayList<>();

    @GetMapping("test")
    public void test(){
        Order order1 = orderService.creat();
        orderService.pay(order1.getId());
        orderService.deliver(order1.getId());
        //orderService.receive(order1.getId());
        orderList.add(order1);
        Order order2 = orderService.creat();
        orderService.pay(order2.getId());
        orderService.deliver(order2.getId());
        orderService.receive(order2.getId());
        orderList.add(order2);
        Order order3 = orderService.creat();
        orderService.pay(order3.getId());
        orderService.deliver(order3.getId());
        orderService.receive(order3.getId());
        orderList.add(order3);
        Console.log(orderList);

    }
}
